<?php
namespace AiSPRDocManager;


/**
 * Description of Controller
 *
 * @author Asfer <rmasfer@gmail.com>
 */
class Controller {

	public function initialize () {

		$this->cssFrontEnd();
		$this->jsFrontEnd();

		$this->initialisePlugin();
		$this->initialiseAjax();
	}

	private function initialisePlugin () {

		$oHome = new Controller\Home();
		add_action('admin_menu', array($oHome, 'initialise'));

		$oModified = new Controller\Modified();
		add_action('admin_menu', array($oModified, 'initialise'));
	}

	private function initialiseAjax () {
		add_action('wp_ajax_' . aiCvManager_Plugin_Slug . '_cvUpload', array('AiSPRDocManager\Controller\Ajax', 'cvUpload'));
		add_action('wp_ajax_nopriv_' . aiCvManager_Plugin_Slug . '_cvUpload', array('AiSPRDocManager\Controller\Ajax', 'cvUpload'));

	}

	private function jsFrontEnd () {
		add_action('wp_enqueue_scripts', function () {
			wp_enqueue_script( aiCvManager_Plugin_Slug. 'jqueryform', aiCvManager_Plugin_Url . '/assets/js/library/jquery.form.min.js', array('jquery'));
		});

		add_action('wp_enqueue_scripts', function () {
			wp_enqueue_script( aiCvManager_Plugin_Slug. 'aicvmanager', aiCvManager_Plugin_Url . '/assets/js/aicvmanager.js', array('jquery'));
		});

		add_action('wp_enqueue_scripts', function () {
			wp_enqueue_script( aiCvManager_Plugin_Slug. 'jquery.blockUI.js', aiCvManager_Plugin_Url . '/assets/js/library/blockUi/js/jquery.blockUI.js', array('jquery'));
		});

	}

	private function cssFrontEnd () {
		add_action('wp_enqueue_scripts', function () {
			wp_enqueue_style( aiCvManager_Plugin_Slug. 'form', aiCvManager_Plugin_Url . '/assets/css/form.css');
		});
	}

	private function install () {
		Setup::createCvManager();
	}
}

?>